package me.haoliang

/**
  * author: planck 
  * createTime: 2016/10/12.
  */
object FunctionScala {

  //Unit返回值相当于void可以省略
  def printHello(a: String): Unit = {
    //函数嵌套
    def toPrint(a: String) = {
      println(a)
    }
    toPrint("hello " + a)
  }

  //普通函数
  def sumStr(a: String, b: String): String = {
    return a + b
  }

  //匿名函数
  var mul = (x: Int, y: Int) => x * y

  def main(args: Array[String]): Unit = {
    printHello(sumStr("lu", "hui"))
    println(mul.apply(2, 3))
  }
}
